local yisi = fk.CreateSkill {
  name = "cf_yisi" }

Fk:loadTranslationTable {
  ["cf_yisi"] = "遗嗣",
  [":cf_yisi"] = "当有角色进入濒死状态时，你可以令至多两名角色各摸两张牌。",
  ["#cf_yisi"] = "令至多两名角色各摸两张牌。",
  ["$cf_yisi1"] = "适可而止。",
  ["$cf_yisi2"] = "麻烦的家伙。",
}

yisi:addEffect(fk.EnterDying, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(yisi.name)
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = room:askToChoosePlayers(player, {
      skill_name = yisi.name,
      max_num = 2,
      min_num = 1,
      targets = room.alive_players,
      cancelable = true,
      prompt = "#cf_yisi"
    })
    if #to > 0 then
      for _, p in ipairs(to) do
        p:drawCards(2, yisi.name)
      end
    end
  end
})

return yisi
